home *** CD-ROM | disk | FTP | other *** search
/ CD Exchange / CD Exchange - Volume 1.iso / graphics / utils / videotracker / develop / sourceaga / copperpicture.s < prev    next >
Text File  |  1994-01-11  |  48KB  |  2,259 lines

  1.  
  2. ;rout            ;when this is off, the routine-file will be
  3.             ;assembled, on=testing
  4.             
  5. ;debug            ;when this is on, colors in the background will
  6.             ;show how much time the routine needs.
  7.  
  8. ;ntsctest        ;when this is on, the routineplayer is in ntsc-mode
  9.  
  10. ;ocs            ;off=AGA,on=OCS testing not possible on OCS !
  11.  
  12. routinemode    equ    1    ;the routinemode !
  13.  
  14.  
  15. ; VideoTracker AGA developer source 25-12-93
  16. ; 24-bits colors, Super-HiRes, HAM8, maximum burstmode (64 pixels aligned)
  17. ; wich makes low-resolution overscan a bit ugly.
  18. ; no "interactive" support anymore, it's only used by Kick 1.3 users.
  19.  
  20. ; the first part of the source handles the things that are necessary to
  21. ; show the picture/copper and playing of the routine.
  22. ; the part between the "***" lines is the routine-source.
  23. ; at the bottom of the file, there are the necessary incbin-files who
  24. ; are needed to test the routine.
  25. ; these are saved with "save effect" in videotracker. they are raw
  26. ; data files which can be fonts,pictures,landscapes,vectorobjects
  27. ; etcetra.
  28. ; the incbin-files are put in the "variables" table, in the routine-
  29. ; player-handler
  30. ; the place where it's done can be found by searching for "!!!"
  31.  
  32.     opt    a+    ;devpac 3 optimize
  33.     opt    o+
  34.  
  35. vew_wid    equ    44
  36. vew_hgt    equ    290
  37. win_hgt    equ    117
  38. win_str    equ    $1a
  39.  
  40.         ifd    ocs
  41. pic_wid        equ    4        ;wide in bytes
  42. pic_hgt        equ    6        ;hoogte
  43. pic_dpt        equ    8        ;number planes
  44. pic_ani        equ    10        ;aantal effes (anim)
  45. pic_vew        equ    12        ;viewmode
  46. pic_cycstr    equ    14        ;cycle start (*4)
  47. pic_cycend    equ    15        ;cycle end (*4)
  48. pic_cycspd    equ    16        ;cycle speed (*4)
  49. pic_cycadd    equ    17        ;cycle add (*4)
  50. pic_palnum    equ    30        ;aantal kleuren
  51. pic_pal        equ    32        ;palette start
  52. pic_palsiz    equ    256*2        ;vaste palette size
  53. pic_raw        equ    pic_pal+pic_palsiz    ;palette start
  54.         endc
  55.         
  56.         ifnd    ocs
  57. pic_wid        equ    4        ;wide in bytes
  58. pic_hgt        equ    6        ;hoogte
  59. pic_dpt        equ    8        ;number planes
  60. pic_ani        equ    10        ;aantal effes (anim)
  61. pic_vew        equ    12        ;viewmode
  62. pic_cycstr    equ    14        ;cycle start (*8)
  63. pic_cycend    equ    15        ;cycle end (*8)
  64. pic_cycspd    equ    16        ;cycle speed (*8)
  65. pic_cycadd    equ    17        ;cycle add (*8)
  66. pic_widmod    equ    46        ;animation-width modulo
  67. pic_future    equ    50        ;free future space
  68. pic_palnum    equ    62        ;aantal kleuren
  69. pic_pal        equ    64        ;palette start
  70. pic_palsiz    equ    256*4        ;vaste palette size (longwords)
  71. pic_raw        equ    pic_pal+pic_palsiz    ;palette start
  72.         endc
  73.         
  74. var_len        equ    $300        ;lengte vartabel
  75.  
  76. var__GfxBase    equ    $000        ;graphics lib
  77. var_pic1    equ    $004        ;current picture
  78. var_anispd1    equ    $008        ;animspeed
  79. var_anitel1    equ    $00c        ;animcount
  80. var_cprbck    equ    $010        ;copperback
  81. var_bck        equ    $014        ;background
  82. var_pic2    equ    $018        ;current picture
  83. var_ntsc    equ    $01c        ;ntsc/pal frequence
  84. var_lnd        equ    $020        ;landscape
  85. var_anilop1    equ    $024
  86. var_rottrg    equ    $028        ;effect trigger
  87. var_txt1    equ    $040        ;text
  88. var_txt16    equ    15*4+var_txt1
  89. var_vec1    equ    $080        ;vectors
  90. var_vec16    equ    15*4+var_vec1
  91. var_fon1    equ    $0c0        ;fonts
  92. var_fon16    equ    15*4+var_fon1
  93. var_cols1    equ    $100        ;colorsets
  94. var_cols16    equ    15*4+var_cols1
  95. var_obj1    equ    $180        ;objects
  96. var_obj16    equ    15*4+var_obj1
  97.  
  98.     ifd    rout
  99.     ;videotracker routine-test
  100.  
  101.     incdir    "videotracker:include/"
  102.     include    "exec/types.i"
  103.     include    "graphics/gfxbase.i"
  104.     include    "lvo/graphics_lib.i"
  105.     incdir    'videotracker:effect/'
  106.  
  107.     SECTION    1,CODE_C
  108. tus
  109.     lea    var,a0
  110.     move.l    #rotsrc,curpic1        ;picture !!!
  111.     move.l    #rotsrc,curpal1        ;palette !!!
  112.     move.l    #rotset,var_cols1(a0)    ;colorset !!!
  113.  
  114.     move.l    ($4).w,a6
  115.     sub.l    a1,a1
  116.     jsr    -$126(a6)        ;findtask
  117.     move.l    d0,curtsk
  118.     move.l    d0,a0
  119.     move.l    $b8(a0),tskpri
  120.  
  121.     lea    dosnam,a1        ;doslib openen
  122.     moveq.l    #0,d0
  123.     move.l    (4).w,a6
  124.     jsr    -408(a6)        ;openlib
  125.     move.l    d0,doslib
  126.  
  127.     bsr.s    label5            ;videotracker opstarten
  128.     
  129.     move.l    curtsk,a0
  130.     move.l    tskpri,$b8(a0)
  131.     move.l    ($4).w,a6
  132.     jsr    -$84(a6)        ;forbid
  133.  
  134.     move.l    doslib,a1
  135.     move.l    (4).w,a6
  136.     jsr    -414(a6)        ;closelib
  137.  
  138.     moveq.l    #0,d0
  139.     rts
  140.     
  141. label5
  142.     move.l    (4).w,a6        ;workbench gedoe
  143.  
  144.     move.b    530(a6),ntscmode    ;50/60 hertz halen
  145.  
  146.     ifd    ntsctest
  147.     move.b    #60,ntscmode        ;60 hertz (ntsc)
  148.     endc
  149.  
  150.     cmp.b    #50,ntscmode        ;ntsc ?
  151.     beq.s    str.ntsc
  152.     move.l    #vew_hgt-56,hogscr    ;set NTSC screen hight
  153. str.ntsc
  154.  
  155.     lea    cprjmp,a2        ;copjmp zetten !
  156.     move.l    #cprbck-8,d0
  157.     move.w    d0,6(a2)
  158.     swap    d0
  159.     move.w    d0,2(a2)
  160.  
  161.     lea    cprbck-8,a2        ;copstr zetten !
  162.     move.l    #cpr,d0
  163.     move.w    d0,6(a2)
  164.     swap    d0
  165.     move.w    d0,2(a2)
  166.  
  167.     bsr    cprsprrem        ;sprites legen
  168.  
  169.     lea    gfxnam,a1        ;graphics lib openen
  170.     move.l    (4).w,a6
  171.     jsr    -408(a6)        ;openlib
  172.     move.l    d0,a6
  173.     move.l    d0,gfxlib
  174.     move.l    38(a6),oldcprlist
  175.  
  176.     bset    #1,$bfe001
  177.     bsr    copbuf            ;copper vullen
  178.  
  179.     bsr    sysoff
  180.  
  181. gadrun
  182.     btst    #6,($bfe001).l
  183.     bne    gadrun
  184.  
  185. scrend
  186. scrend.play
  187.     bsr    syson
  188.  
  189.     move.l    gfxlib,a1
  190.     move.l    (4).w,a6
  191.     jsr    -414(a6)        ;closelib
  192.  
  193. scrend.qb
  194.     moveq.l    #0,d0    
  195.     rts
  196.     
  197.     ;vertical blank interrupt, no blits.
  198.     ;handles counters,interlace,sprite
  199.     ;level 3
  200.  
  201. intvb
  202.     bra.s    intvb.cnt
  203.     dc.l    'VIDU'
  204.     dc.l    'LOOP'
  205. intvb.cnt
  206.     movem.l    d0-d7/a0-a6,-(sp)
  207.     lea    ($dff000).l,a6
  208.  
  209.     move.w    $01e(a6),d0
  210.     btst    #5,d0            ;vblank ?
  211.     bne.s    intvb.vb
  212.  
  213.     bra.s    intcop.end
  214.  
  215. intvb.vb
  216.     bsr    grap
  217.     bsr    palctr            ;palette zetten
  218.     bsr.s    copbuf            ;copper vullen
  219.     
  220. intvb.end
  221.     move.w    #$0020,$09c(a6)    ;vb bit wissen
  222.     movem.l    (sp)+,d0-d7/a0-a6    ;multitask uit, shit !
  223.     rte
  224.  
  225. intcop.end
  226.     movem.l    (sp)+,d0-d7/a0-a6
  227.     move.l    intvbold,-(sp)
  228.     rts
  229.  
  230.     ;transmission buffer empty routine, BLIT !
  231.     ;handles routines,animations
  232.     
  233. inttbe                    ;tbe interrupt
  234.     movem.l    d0-d7/a0-a6,-(sp)
  235.     lea    ($dff000).l,a6
  236.  
  237.     move.w    $01e(a6),d0
  238.     btst    #0,d0            ;no tbe ?
  239.     beq.s    intdskblk
  240.  
  241.  
  242.     btst    #6,($bfe001).l        ;muis ingedrukt ?
  243.     beq.s    inttbe.cop
  244.     btst    #2,($dff016).l
  245.     beq.s    inttbe.cop
  246.  
  247.     ifd    debug
  248.     move.w    #$700,$dff180
  249.     endc
  250.     
  251.     bsr    rotply            ;routineplayer BLIT !
  252.     bsr.s    copbuf            ;copper vullen
  253.  
  254.     ifd    debug
  255.     move.w    #$070,$dff180
  256.     endc
  257.     
  258. inttbe.cop
  259.  
  260. inttbe.end
  261.     move.w    #$0001,$09c(a6)
  262.     movem.l    (sp)+,d0-d7/a0-a6
  263.     rte
  264.  
  265. intdskblk
  266.     move.w    #$0001,$09c(a6)        ;be sure for no tbe handling
  267.     movem.l    (sp)+,d0-d7/a0-a6
  268.     move.l    inttbeold,-(sp)
  269.     rts
  270.  
  271.  
  272.     ;moves the copperbuffer to the copperlist
  273.     ;sort of double buffering
  274.     
  275. copbuf
  276.     movem.l    d0-d7/a0-a6,-(sp)
  277.  
  278.     lea    ($dff000).l,a6
  279.  
  280. copbuf.novb                ;copperchange overslaan
  281.     moveq.l    #0,d0
  282.     move.b    $005(a6),d0
  283.     lsl.w    #8,d0
  284.     moveq.l    #0,d1
  285.     move.b    $006(a6),d1
  286.     add.w    d1,d0
  287.  
  288.     cmp.w    #$4,d0            ;lower limit, all stations 100%
  289.     blt    copbuf.novb
  290.  
  291.     cmp.b    #50,ntscmode
  292.     beq.s    copbuf.pal
  293.     cmp.w    #$133-72-8,d0        ;ntsc grens
  294.     bge    copbuf.novb
  295.     bra.s    copbuf.cont
  296. copbuf.pal
  297.     cmp.w    #$133-8,d0        ;pal grens
  298.     bge    copbuf.novb
  299. copbuf.cont
  300.  
  301.     lea    gra.s,a0        ;buffer copieren
  302.     lea    cprbuf,a1
  303. copbuf_aga                ;AGA stuff :)
  304.     move.l    #(gra.ql)/4-1,d0
  305. copbuf.a
  306.     move.w    2(a0),2(a1)
  307.     add.l    #4,a0
  308.     add.l    #4,a1
  309.     dbra    d0,copbuf.a
  310.  
  311. copbuf.end
  312.     movem.l    (sp)+,d0-d7/a0-a6
  313.     rts
  314.  
  315.     ;goes back to the workbench
  316.     
  317. syson
  318.     movem.l    d0-d7/a0-a6,-(sp)
  319.  
  320.     move.w    #$0001,$dff09a        ;tbeint uit
  321.     move.l    intvbold,($6c).w
  322.     move.l    inttbeold,($64).w
  323.  
  324.     move.l    4,a6
  325.     jsr    -138(a6)        ;permit
  326.  
  327.     move.l    gfxlib,a6
  328.     jsr    -462(a6)        ;disownblitter
  329.  
  330.     move.l    wbview,a1
  331.     move.l    gfxlib,a6
  332.     jsr    _LVOLoadView(a6)     ; Fix view
  333.     jsr    _LVOWaitTOF(a6)
  334.     jsr    _LVOWaitTOF(a6)         ; wait for LoadView()
  335.  
  336. syson.ras
  337.     cmp.b    #$c0,$dff006        ;prevent copperjump
  338.     bne    syson.ras
  339.  
  340.     move.l    gfxlib,a6
  341.     move.l    gb_copinit(a6),$dff080     ; Kick it into life
  342.  
  343.     movem.l    (sp)+,d0-d7/a0-a6
  344.     rts
  345.     
  346.     ;goes back to the gadgetscreen
  347.     
  348. sysoff
  349.     movem.l    d0-d7/a0-a6,-(sp)
  350.      
  351.     move.l    gfxlib,a6
  352.     move.l    gb_ActiView(a6),wbview    ;current view
  353.     sub.l    a1,a1            ; clear a1
  354.     jsr     _LVOLoadView(a6)     ; Flush View to nothing
  355.     jsr    _LVOWaitTOF(a6)     ; Wait once
  356.     jsr    _LVOWaitTOF(a6)     ; Wait again.
  357.  
  358.     move.l    gfxlib,a6
  359.     jsr    -456(a6)        ;ownblitter
  360.  
  361.     move.l    4,a6
  362.     jsr    -132(a6)        ;forbid
  363.         
  364.     move.l    ($6c).w,intvbold
  365.     move.l    #intvb,($6c).w
  366.     move.l    ($64).w,inttbeold
  367.     move.l    #inttbe,($64).w
  368.     move.w    #$8001,$dff09a        ;tbeint aan
  369.     bsr    gracpr            ;reset copper
  370.     bsr    copbuf            ;copy copper
  371.     move.l    #cpr,$dff080
  372.  
  373.     movem.l    (sp)+,d0-d7/a0-a6
  374.     rts
  375.     
  376. cprsprrem
  377.     movem.l    d0-d7/a0-a6,-(sp)
  378.     lea    cprspr,a0
  379.     move.l    #sprdat,d0
  380.     move.w    #7,d1
  381. cprsprrem.a
  382.     move.w    d0,3*2(a0)
  383.     swap    d0
  384.     move.w    d0,1*2(a0)
  385.     swap    d0
  386.     add.l    #8,a0
  387.     dbra    d1,cprsprrem.a
  388.     movem.l    (sp)+,d0-d7/a0-a6
  389.     rts
  390.  
  391. varset                    ;variablen neerzetten
  392.     movem.l    d0-d7/a0-a6,-(sp)
  393.     move.l    #var,a0
  394.  
  395.     move.l    #cprbck,var_cprbck(a0)
  396.     move.l    gfxlib,var__GfxBase(a0)
  397.     move.b    ntscmode,var_ntsc(a0)
  398.  
  399.     move.l    curpic1,var_pic1(a0)    ;variabel
  400.     move.l    curpic2,var_pic2(a0)    ;variabel
  401.     move.w    anispd1,var_anispd1(a0)
  402.     move.w    anitel1,var